from db.dbUtils import MysqlPool


def get_grade_by_class_id(class_id):
    with MysqlPool() as pool:
        c = pool.cursor
        sql = "select * from se_grade where c_id='{}'".format(class_id)
        c.execute(sql)
        r = c.fetchall()
        if r:
            return r[0]
        return None


def get_grades_by_m_id_dao(m_id):
    sql = """
    select * from `se_grade` where `m_id`={}
    """.format(m_id)
    with MysqlPool() as pool:
        cursor = pool.cursor
        cursor.execute(sql)
        return cursor.fetchall()
